<#assign domain="${ctx.contextPath}" />
<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta http-equiv="x-ua-compatible" content="IE=Edge, chrome=1"/>
	<meta name="renderer" content="webkit">
	<title>scoreCard2</title>
	<link rel="stylesheet" href="${domain}/static/css/common/bootstrap.min.css">
	<link rel="stylesheet" href="${domain}/static/css/common/base.css">
	<link rel="stylesheet" href="${domain}/static/css/common/header.css">
	<link rel="stylesheet" href="${domain}/static/css/chsi.css">
	<script src="${domain}/static/js/jquery-3.2.1.slim.min.js"></script>
	<script src="${domain}/static/js/bootstrap.min.js"></script>
	<script src="${domain}/static/js/jquery-3.2.1.min.js"></script>
	<script src="${domain}/static/js/bootstrap.min.js"></script>
	 <link rel="stylesheet" href="${domain}/static/css/bootstrap.css">
	  <link rel="stylesheet" href="${domain}/static/css/bootstrapValidator.css">
	 <script src="${domain}/static/js/bootstrapValidator.js"></script>
</head>
<body>

<div class="content">
	<!--侧边导航-->
	<div class="score-card2">
		<div class="wrap">
			<form id="defaultForm" method="post" class="form-horizontal" action="${domain}/ch/loginChsi">
				<h1>学信网信息查询</h1>
				<div class="form-group">
					<input type="text" class="form-control" placeholder="学信网账号" name="user_name">
				</div>
				<div class="form-group">
					<input type="password" class="form-control" placeholder="密码" name="user_pass">
					
					<input type="hidden" class="form-control" placeholder="id" name="id" value="${id}">
				</div>
				<div class="form-group">
  					<div class="line">
					    <input type="text" class="form-control" placeholder="验证码" name="auth_code">
					     <input type="hidden" class="form-control" placeholder="task_id" id="task_id" name="task_id">
					    <div class="img" id="img_id">
						    <img alt="验证码" class="form-control" id="chsiimg_id">
					    </div>
				    </div>
				</div>
				<div name="signup">
           <button type="submit" class="btn btn-primary" data-loading-text="Loading..." autocomplete="off" onclick="loag()" id="btn_login" style="width:300px;margin:0 auto;display:block;">查询</button>
                </div>

			</form>
                                
		</div>
	</div>
</div>

</body>

<script>
yanzheng();
function yanzheng(){
 $.ajax({
                cache: true,
                type: "POST",
                url:"${domain}/ch/getCode",
                data:null,
                async: true,
                error: function(request) {
                },
                success: function(data) {
                  document.getElementById("chsiimg_id").src=data.split("=")[2]+data.split("=")[0];
                  $("#task_id").val(data.split("=")[1]);
                }
            });
}


$("#img_id").click(function(){
yanzheng()
});



function loag() {
$.ajax({
                cache: true,
                type: "POST",
                url:"../antifraud/cost",
                data:{type:2},// 你的formid
                async: false,
                error: function(request) {
                },
                success: function(data) {
                if(data=='1'){
                  $("#btn_login").attr("type","");
                alert("余额不足！请联系客服！");
                }else{
                var flag = $("#defaultForm").data("bootstrapValidator").isValid();
     if(flag==true){
      var btn = $("#btn_login");
      btn.text('加载中......');
      }
                }
                }
 })



    }


 $(document).ready(function() {

    $('#defaultForm').bootstrapValidator({
//        live: 'disabled',
        message: 'This value is not valid',
        feedbackIcons: {
            valid: 'glyphicon glyphicon-ok',
            invalid: 'glyphicon glyphicon-remove',
            validating: 'glyphicon glyphicon-refresh'
        },
        fields: {
            user_name: {
                group: '.form-group',
                validators: {
                    notEmpty: {
                        message: '请输入学信网账号'
                    },
                        stringLength: {/*长度提示*/
                            min: 1,
                            max: 30,
                            message: '输入长度过长'
                        }
                }
            },
        user_pass: {
                group: '.form-group',
                validators: {
                    notEmpty: {
                        message: '请输入密码'
                    },
                        stringLength: {/*长度提示*/
                            min: 1,
                            max: 18,
                            message: '请输入11位数字'
                        }
                }
            },
          auth_code: {
                group: '.form-group',
                validators: {
                    notEmpty: {
                        message: '请输入验证码'
                    },
                    stringLength: {/*长度提示*/
                            min: 1,
                            max: 15,
                            message: '请输入正确验证码'
                        }
                }
            },
             idCard: {
                group: '.form-group',
                validators: {
                    notEmpty: {
                        message: '请输入身份证号'
                    },
                    regexp: {/* 只需加此键值对，包含正则表达式，和提示 */
                            regexp: /^[a-zA-Z0-9_\.]+$/,
                            message: '请输入正确格式'
                        },
                    stringLength: {/*长度提示*/
                            min: 15,
                            max: 20,
                            message: '请输入正确身份证号'
                        }
                }
            },
        
          
        }
    });


});
           
</script>
</html>